package com.yeren.ams.all;




import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.yeren.ams.api.model.Account;
import com.yeren.ams.api.service.AccountService;
import com.yeren.ams.api.service.DemoService;

/**
 * liubiao
 */
public class Consumer {

	public static void main(String[] args) throws Exception {
		ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
				new String[] { "consumer.xml" });
		context.start();
		///////////////////////////////////////////////////////////
		DemoService demoService = (DemoService) context.getBean("demoService"); // 获取远程服务代理
		String hello = demoService.sayHello(" hellworld dubbo!"); // 执行远程方法
		System.out.println(hello); // 显示调用结果
		///////////////////////////////////////////////////////////
//		ZthService zthService = (ZthService) context.getBean("zthService");
//		System.out.println("------------" + zthService.findAll());
//		ZTH zth=new ZTH();
//		zth.setName("刘彪");
//		zthService.save(zth);
		///////////////////////////////////////////////////////////
		AccountService accountService=(AccountService) context.getBean("accountService");
		Account account=new Account();
		account.setId(12);
		account.setAccount("heihei");
		accountService.save(account);
		
		context.close();
	}

}